from openai import OpenAI 
 
client = OpenAI(
    api_key="e07484c365a3d8b468a4d9e06b36317a.momrwta4EftapAwx",
    base_url="https://open.bigmodel.cn/api/paas/v4/"
) 
 
response = client.chat.completions.create(
    model="glm-4-flash-250414",  
    messages=[    
        {"role": "system", "content": "你是一个聪明且富有创造力的小说作家"},    
        {"role": "user", "content": "请你作为童话故事大王，写一篇短篇童话故事。"} 
    ],
    top_p=0.7,
    temperature=0.9
) 
 
print(response.choices[0].message.content)